package main

import (
	"code.google.com/p/go8/chip8"
	"time"
)

// creates real tickers for timing
type tickerFactory struct{}

func (_ tickerFactory) New() chip8.TimedTicker { return &timedTicker{} }

type timedTicker struct {
	ticker *time.Ticker
}

func (t *timedTicker) Start(interval time.Duration) {
	t.ticker = time.NewTicker(interval)
}

func (t *timedTicker) Channel() <-chan time.Time {
	return t.ticker.C
}

func (t *timedTicker) Stop() { t.ticker.Stop() }
